//-----------------------------------------------------------------------------
// Bend2D - Physics Engine
// Roberto Bender <beto.bender@gmail.com>
// Description: 
// Date: 08/03/2010
//-----------------------------------------------------------------------------
#ifndef MOVEABLE_H
#define MOVEABLE_H

#include "speed.h"
#include "angle.h"
#include "point.h"
#include "acceleration.h"

#include <list>
using namespace std;

namespace bend2d
{
    class Moveable 
    {
        public:
            typedef list<Moveable*> MoveableList;
            MoveableList::iterator& GetMoveableIterator();

            virtual ~Moveable() {}

            virtual const Point& GetPosition() const;
            virtual void SetPosition(const Point& point);
            virtual const Angle& GetAngle() const;
            virtual void SetAngle(const Angle& angle);

            const Speed& GetSpeed() const;
            const Acceleration& GetAcceleration() const;
            const Acceleration& GetNewAcceleration() const;
            const Acceleration& GetExternalAcceleration() const;
            const Angle& GetNewAngle() const;

            void SetSpeed(const Speed& speed);
            void SetAcceleration(const Acceleration& acceleration);
            void SetExternalAcceleration(const Acceleration& acceleration);
            void SetNewSpeed(const Speed& speed);
            void SetNewAcceleration(const Acceleration& acceleration);
            const Speed& GetNewSpeed() const;

            const Point& GetNewPosition() const;
            void SetNewPosition(const Point& point);
            void ResetNewPosition();
			
            void ResetMove();
            void Move(double timeSinceLastFrame);
            void Moved();

            void AddInstantAcceleration(const Acceleration& acceleration);
            const Acceleration& GetInstantAcceleration() const;

            void SetMaxSpeed(const Speed& speed);
            const Speed& GetMaxSpeed() const;

        private:
            void TestSpeedContraints();

            MoveableList::iterator m_Iterator;
            Point m_Position;
            Point m_NewPosition;
            Speed m_Speed;
            Speed m_NewSpeed;
            Speed m_MaxSpeed;
            Acceleration m_Acceleration;
            Acceleration m_NewAcceleration;
            Acceleration m_ExternalAcceleration;
            Acceleration m_InstantAcceleration;
            Angle m_Angle;
            Angle m_NewAngle;
    };
}

#endif
